home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / bash-1.12 / dist / lib / readline / Makefile < prev    next >
Encoding:
Makefile  |  1991-11-03  |  4.0 KB  |  138 lines

  1. ## -*- text -*- ####################################################
  2. #                                   #
  3. # Makefile for readline and history libraries.               #
  4. #                                   #
  5. ####################################################################
  6.  
  7. # Here is a rule for making .o files from .c files that doesn't force
  8. # the type of the machine (like -sun3) into the flags.
  9. .c.o:
  10.     $(CC) -c $(CFLAGS) $(LOCAL_INCLUDES) \
  11.         $(READLINE_DEFINES) $(CPPFLAGS) $*.c
  12.  
  13. # Destination installation directory.  The libraries are copied to DESTDIR
  14. # when you do a `make install', and the header files to INCDIR/readline/*.h.
  15. DESTDIR = /usr/local/lib
  16. INCDIR = /usr/local/include
  17.  
  18. # Define TYPES as -DVOID_SIGHANDLER if your operating system uses
  19. # a return type of "void" for signal handlers.
  20. # TYPES = -DVOID_SIGHANDLER
  21.  
  22. # Define USG as -DUSG if you are using a System V operating system.
  23. #USG = -DUSG
  24.  
  25. # HP-UX compilation requires the BSD library.
  26. #LOCAL_LIBS = -lBSD
  27.  
  28. # Xenix compilation requires -ldir -lx
  29. #LOCAL_LIBS = -ldir -lx
  30.  
  31. # Comment out "-DVI_MODE" if you don't think that anyone will ever desire
  32. # the vi line editing mode and features.  Make sure to comment out the
  33. # definition of VI if you remove the -DVI_MODE.
  34. READLINE_DEFINES = $(TYPES) -DVI_MODE
  35.  
  36. DEBUG_FLAGS = -g
  37. LDFLAGS = $(DEBUG_FLAGS) 
  38. CFLAGS = $(DEBUG_FLAGS) $(USG) -I.
  39.  
  40. # A good alternative is gcc -traditional.
  41. #CC = gcc -traditional
  42. CC = cc
  43. RANLIB = /usr/bin/ranlib
  44. AR = ar
  45. RM = rm
  46. CP = cp
  47.  
  48. LOCAL_INCLUDES = -I../
  49.  
  50. XMALLOC_DIR = ../malloc/
  51. XMALLOC_C   = $(XMALLOC_DIR)xmalloc.c
  52. TILDE_DIR   = ../glob/
  53. TILDE_C     = $(TILDE_DIR)tilde.c
  54.  
  55. CSOURCES = readline.c history.c funmap.c keymaps.c vi_mode.c \
  56.        emacs_keymap.c vi_keymap.c $(XMALLOC_C) $(TILDE_C)
  57.  
  58. HSOURCES = readline.h chardefs.h history.h keymaps.h
  59. SOURCES  = $(CSOURCES) $(HSOURCES)
  60.  
  61. OBJECTS = readline.o vi_mode.o history.o funmap.o keymaps.o xmalloc.o tilde.o
  62.  
  63. DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo \
  64.         doc/hist.texinfo doc/hsuser.texinfo doc/hstech.texinfo
  65. DOCOBJECT = doc/readline.dvi doc/history.dvi
  66. DOCSUPPORT = doc/Makefile doc/texinfo.tex
  67. DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
  68.  
  69. SUPPORT = COPYING Makefile $(DOCUMENTATION) ChangeLog examples
  70.  
  71. THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
  72.  
  73. ##########################################################################
  74.  
  75. all: libreadline.a
  76.  
  77. libreadline.a:    $(OBJECTS)
  78.     $(RM) -f $@
  79.     $(AR) clq $@ $(OBJECTS)
  80.     -if [ -f "$(RANLIB)" ]; then $(RANLIB) libreadline.a; fi
  81.  
  82. readline: readline.h chardefs.h $(OBJECTS)
  83.     $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
  84.       $(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
  85.       $(TILDE_O) $(XMALLOC_O) keymaps.o history.o -L. -ltermcap
  86.  
  87. # These next two rules are designed to ensure that the object files
  88. # are left in the current directory.
  89. #
  90. tilde.o: $(TILDE_C)
  91.     rm -f tilde.o
  92.     $(CC) $(CFLAGS) $(CPPFLAGS) -c $(TILDE_C)
  93.     @-cp tilde.o $(TILDE_DIR)
  94.     @-cp $(TILDE_DIR)tilde.o tilde.o
  95.  
  96. xmalloc.o: $(XMALLOC_C)
  97.     rm -f xmalloc.o
  98.     $(CC) $(CFLAGS) $(CPPFLAGS) -c $(XMALLOC_C)
  99.     @-cp xmalloc.o $(XMALLOC_DIR)
  100.     @-cp $(XMALLOC_DIR)xmalloc.o xmalloc.o
  101.  
  102. readline.o:    readline.c readline.h chardefs.h  keymaps.h history.h
  103. history.o:    history.c history.h
  104. vi_mode.o:    vi_mode.c
  105. funmap.o:    funmap.c readline.h
  106. keymaps.o:    keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h
  107.  
  108. documentation: force
  109.     (cd doc; make)
  110. force:
  111.  
  112. readline.tar:    $(THINGS_TO_TAR)
  113.     tar -cf readline.tar $(THINGS_TO_TAR)
  114.  
  115. readline.tar.Z:    readline.tar
  116.     compress -f readline.tar
  117.  
  118. install:    $(DESTDIR)/libreadline.a includes
  119.  
  120. # The rule for 'includes' is written funny so that the if statement
  121. # always returns TRUE unless there really was an error installing the
  122. # include files.
  123. includes:
  124.     if [ -r $(INCDIR)/readline ]; then \
  125.       :; \
  126.     else \
  127.       mkdir $(INCDIR)/readline && chmod a+r $(INCDIR)/readline; \
  128.     fi
  129.     $(CP) readline.h keymaps.h chardefs.h $(INCDIR)/readline/
  130. clean:
  131.     rm -f $(OBJECTS) *.a
  132.     (cd doc; make clean)
  133.  
  134. $(DESTDIR)/libreadline.a: libreadline.a
  135.     -mv $(DESTDIR)/libreadline.a $(DESTDIR)/libreadline.old
  136.     cp libreadline.a $(DESTDIR)/libreadline.a
  137.     if [ -f "$(RANLIB)" ]; then $(RANLIB) -t $(DESTDIR)/libreadline.a; fi
  138.